package junitlearning.junitTest;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.*;

import java.util.stream.Stream;

/**
 * @author tongchen
 * @create 2023-07-25 20:14
 */
public class Junit1Test {
    public static Stream<Arguments> generator() {
        return Stream.of( Arguments.arguments("1","小张"),
                Arguments.arguments("2","小李"));
    }

    @Test
    public void test001(){
        System.out.println("测试断言");
        //Assertions.assertTrue(1==2);
        int x=1;
       // Assertions.assertNull(x);
        Assertions.assertNotNull(x);

    }
    @ParameterizedTest
    @ValueSource(strings = {"小刘","小张","小王"})
    public void test002(String s){
        System.out.println(s);
    }
    @ParameterizedTest
    @CsvSource({"1,zhangsan","2,lisi"})
    public void test03(int x,String name){
        System.out.println(x+","+name);
    }
    @ParameterizedTest
   @CsvFileSource(resources = "test.csv")
    public void test004(String x,String name){
        System.out.println(x+","+name);
    }
    @ParameterizedTest
    @MethodSource("generator")
    public void get(String x,String name){
        System.out.println(x+","+name);
    }
}
